from flask import Blueprint
from flask import request,render_template,redirect,url_for
from flask.views import MethodView

# template_folder='',static_folder='' 增加查找蓝图目录路径
article = Blueprint('articles',__name__)

@article.route('/articles/')
def article_list():
    return 'Blueprint article_list'

@article.route('/articles/<id>/')
def article_detail(id=None):
    item ={'id':id}
    return 'article_detail'+str(id)

# 方法视图
class ArticleListView(MethodView):
    def get(self):
        return 'class ArticleListView(MethodView)'

    def post(self):
        pass

# 视图注册到 Blueprint---'route()' ------------class Name----------  def name()
article.add_url_rule('/articles2/',view_func=ArticleListView.as_view('article_list2'))
